package com.xuecheng.manage_cms.service;

import com.xuecheng.framework.domain.cms.CmsSite;
import com.xuecheng.framework.model.response.CommonCode;
import com.xuecheng.framework.model.response.QueryResponseResult;
import com.xuecheng.framework.model.response.QueryResult;
import com.xuecheng.framework.model.response.ResultCode;
import com.xuecheng.manage_cms.dao.CmsSiteRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Aniymx on 2018/12/19 19:23.
 */
@Service
public class CmsSiteService {
    @Autowired
    private CmsSiteRepository cmsSiteRepository;
    //查询所有站点信息
    public QueryResponseResult findAll() {
        List<CmsSite> all = cmsSiteRepository.findAll();
        //封装查询是否成功的信息
        ResultCode resultCode = CommonCode.SUCCESS;
        QueryResult<CmsSite> queryResult = new QueryResult<>();
        queryResult.setList(all);
        QueryResponseResult queryResponseResult = new QueryResponseResult(resultCode, queryResult);
        return queryResponseResult;
    }
}
